import 'package:flutter/material.dart';
import 'package:wechat/common/touch_callback.dart';

class WeChatItem extends StatelessWidget {
  final String title;
  final String? imagePath;
  final Icon? icon;
  const WeChatItem({super.key, required this.title, this.imagePath, this.icon});

  onItemPress(BuildContext context) {
    switch (title) {
      case "朋友圈":
        Navigator.of(context).pushNamed("/friends");
        break;
      case "收藏":
        break;
    }
  }

  @override
  Widget build(BuildContext context) {
    return TouchCallback(
        child: Container(
          height: 56,
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Container(
                margin: const EdgeInsets.only(left: 22, right: 20),
                child: imagePath != null
                    ? Image.asset(
                        imagePath!,
                        width: 32,
                        height: 32,
                      )
                    : SizedBox(
                        width: 32,
                        height: 32,
                        child: icon,
                      ),
              ),
              Text(
                title,
                style: const TextStyle(fontSize: 16, color: Color(0xFF333333)),
              )
            ],
          ),
        ),
        onPress: () {
          onItemPress(context);
        });
  }
}
